<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改用户')" />
	<th:block th:include="include :: select2-css" />
</head>
<body>
    <div class="main-content">
        <form class="form-horizontal" id="form-user-edit" th:object="${user}">
            <input name="sysuserId"  type="hidden"  th:field="*{sysuserId}" />
<!--			<input name="categoryId"  type="hidden"  th:field="*{categoryId}" id="treeId"/>-->
            <h4 class="form-header h4">基本信息</h4>
            <div class="row">
            	<div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">用户账户：</label>
                        <div class="col-sm-8">
                            <input name="userName" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" th:field="*{username}" required>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">用户昵称：</label>
                        <div class="col-sm-8">
                            <div class="input-group">
                                <input class="form-control" type="text" placeholder="请输入用户昵称" name="name"  th:field="*{name}" required>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">手机号码：</label>
                        <div class="col-sm-8">
                            <input name="mobile" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" th:field="*{mobile}" required>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">用户状态：</label>
                        <div class="col-sm-8">
                            <label class="toggle-switch switch-solid">
                                <input type="checkbox" id="status" th:checked="${user.status == '1' ? true : false}">
                                <span></span>
                            </label>
                        </div>
                    </div>
                </div>
            </div>


            <h4 class="form-header h4">其他信息</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label">备注：</label>
                        <div class="col-xs-10">
                            <textarea name="remark" maxlength="500" class="form-control" rows="3">[[*{name}]]</textarea>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: select2-js" />
	<script th:inline="javascript">
        var prefix = ctx + "user";
        //遍历回显用户角色
        //获取json对象
        
        function submitHandler() {
            //提交
	        if ($.validate.form()) {
	        	var status = $("input[id='status']").is(':checked') == true ? 1 : 0;
                var mobile=$("#mobile").val();
                var name=$("#name").val();
                var username=$("#username").val();
                var sysuserId=$("#sysuserId").val();

                var data={};
	        	data.sysuserId=sysuserId;
	        	data.mobile=mobile;
	        	data.status=status;
	        	data.username=username;
	        	data.name=name;
	        	// var data={"sysuserId":1,"mobile":mobile,"status":status,"username":username,"name":name,"userRoles":JSON.stringify(userRoles)};
	        	$.operate.saveTab(prefix + "/editUser", JSON.stringify(data));
	        }
	    }


    </script>
</body>
</html>